front page posts

jamesperet 9 years ago
parent
commit
702bb312bc

+ 1 - 1
app/controllers/blog_posts_controller.rb

@@ -7,7 +7,7 @@ class BlogPostsController < ApplicationController
7 7
   # GET /blog_posts
8 8
   # GET /blog_posts.json
9 9
   def index
10
-    @blog_posts = BlogPost.all
10
+    @blog_posts = BlogPost.order('created_at DESC').all
11 11
   end
12 12
 
13 13
   # GET /blog_posts/1

+ 1 - 0
app/controllers/start_controller.rb

@@ -1,6 +1,7 @@
1 1
 class StartController < ApplicationController
2 2
   
3 3
   def index
4
+    @blog_posts = BlogPost.order('created_at DESC').take(4)
4 5
   end
5 6
 
6 7
 end

+ 24 - 1
app/views/start/index.html.erb

@@ -1,4 +1,27 @@
1 1
 <div class="hero-unit">
2 2
   <h1><%= @config.website_name %></h1>
3 3
   <p><%= @config.tagline %></p>
4
-</div>
4
+</div>
5
+
6
+<div class="page-header">
7
+  <h1><%= t 'blog.latest_posts'%> <%= link_to (t 'blog.more_posts'), blog_path, class: 'btn btn-large pull-right' %></h1>
8
+</div>
9
+
10
+<ul class="thumbnails">
11
+    <% @blog_posts.each do |post| %>
12
+	   <li class="span3">
13
+	     <div class="thumbnail" style="height: 300px;">
14
+		  <% if post.image.file != nil %>
15
+		  	<%= image_tag post.image.thumb.to_s %>
16
+		  <% else %>
17
+	       	<img src="http://placehold.it/300x200" alt="">
18
+		  <% end %>
19
+	       <h3><%= link_to post.title, post_path(post) %></h3>
20
+	       <p><%= post.description %></p>
21
+	     </div>
22
+	   </li>
23
+    <% end %>
24
+</ul>
25
+
26
+
27
+<br>

+ 2 - 0
config/locales/en.yml

@@ -259,6 +259,8 @@ en:
259 259
     content: Content
260 260
     submit: Save
261 261
     back: Back
262
+    latest_posts: Latest Posts
263
+    more_posts: More posts
262 264
   contact:
263 265
     contact: Contact
264 266
     contact_messages: Contact Messages

+ 2 - 0
config/locales/pt-BR.yml

@@ -261,6 +261,8 @@ pt-BR:
261 261
     content: Conteúdo
262 262
     submit: Salvar
263 263
     back: Voltar
264
+    latest_posts: Últimos Posts
265
+    more_posts: Mais posts
264 266
   contact:
265 267
     contact: Contato
266 268
     contact_messages: Mensagens de Contato

+ 4 - 3
readme.md

@@ -11,24 +11,25 @@ A template for creating rails websites that includes the following:
11 11
 * Translation (pt-BR, EN)
12 12
 * Contact System
13 13
 - Maintaince Mode
14
+* Email System (PaperClip + Mandrill)
14 15
 
15 16
 Other features are still under development:
16 17
 
17
-* Email System (PaperClip + MailChimp + Mandrill)
18
+- Log
18 19
 - Tests
19 20
 
21
+
20 22
 * Search System
21 23
 * Wiki/Codex
22 24
 - Portfolio
23 25
 - Store
24 26
 - Inventory
25 27
 - Module Controller
28
+- geo location/maps
26 29
 
27 30
 
28 31
 ## Todo's
29 32
 
30
-* contact message sed email
31
-* production emails with mandrill
32 33
 * edit account layout
33 34
 * contact message layout
34 35
 * devise forgot pasword layout